/** @jsxImportSource @emotion/react */
import * as React from "react";
import {Text, useTheme,} from "customize-easy-ui-component";
import {ReportViewProps,} from "../../common/base";
import {末尾链接, 落款单位地址,} from "../../common/rarelyVary";
import {测试综合报告, } from "./viewRes";
import {useRepMenuDirItems} from "../../hook/useMainRepUrlOr";
import {VsProjects默认} from "./Conclusion";
import {useItemsMapPressure} from "../../common/pressure";
import {目录页VS} from "../../movable/rarelyVary";
import {TestInstructionVw} from "./TestInstruction";
import {InstrumentDescVw} from "./InstrumentDesc";
import {ComprehensiveVw} from "./Comprehensive";
import {SituationSuggestVw} from "./SituationSuggest";
import {ReportFirstPageHeadAll} from "../../furnace/rarelyVary";
import {注意事项Thme, 首页设备概况Thme} from "../../furnace/wtThermal/rarelyVary";

//详细测 比简单测 的记录结果还要简化少了？ 乱：？ 暂留"简单热效率测试"的模板：
export const ReportView: React.FunctionComponent<ReportViewProps> = ({
    repId,   source: orc,  verId,rep,
}) => {
    const theme= useTheme();
    const [mapFxian]=useItemsMapPressure({ projects:orc.Projects });
    const [rootMenu]=useRepMenuDirItems(VsProjects默认, orc.Projects, `/reportView/${rep?.modeltype}/ver/${verId}/${repId}`);
    // const [endoscopic_ex ]= useSubRepMain("boiler/endoscopic_ex", {nestMd:'ENDOSCOPIC_EX',orc, repId:repId!, rep, NestMbVer:1});

   return (
    <React.Fragment>
        {rootMenu}
        <div css={{"@media not print": {marginTop: '1rem', marginBottom: '1rem'}}}>
            <div css={{
                display: 'flex',
                flexDirection: 'column',
                justifyContent: 'space-between',
                "@media print": {height: '100vh', pageBreakInside: 'avoid',}
            }}>
                {ReportFirstPageHeadAll({theme, rep, mbbm: 'FJB/JK1120-2022'})}
                <div>
                    <Text variant="h3" css={{
                        textAlign: 'center',
                        "@media (min-width:690px),print and (min-width:538px)": {
                            fontSize: theme.fontSizes[6],
                        }
                    }}>
                     锅炉热效率详细测试报告
                    </Text>
                    <br css={{"@media not print": {display: 'none'}}}/>
                    <Text variant="h5" css={{textAlign: 'center',}}></Text>
                </div>
                <div>
                    {首页设备概况Thme({theme, orc, rep})}
                </div>
                <div css={{textAlign: 'center', "@media print": {pageBreakInside: 'avoid'}}}>
                    {落款单位地址}
                </div>
            </div>
            {注意事项Thme({rep})}

            {目录页VS({theme, orc, rep, suffix: false})}
            {测试综合报告({theme, orc, rep})}

            {mapFxian.get('测试工况及说明')?.do && <TestInstructionVw orc={orc} rep={rep}/>}
            {mapFxian.get('测试仪表说明')?.do && <InstrumentDescVw orc={orc} rep={rep}/>}
            {mapFxian.get('测试数据综合表')?.do && <ComprehensiveVw orc={orc} rep={rep}/>}
            {mapFxian.get('测试情况分析和建议表')?.do && <SituationSuggestVw orc={orc} rep={rep}/>}
        </div>
        {末尾链接({template: rep?.modeltype, verId, repId: repId || ''})}
    </React.Fragment>
    );
}
